package com.cros.pruebas2;

public class PrimitiveAssignments {
	
	public static void main(String argv[]){
		int x = 7; // literal assignment
		int y = x + 2; // assignment with an expression
		// (including a literal)
		int z = x * y; // assignment with an expression
		
		//inlicite cast 
		byte b = 27;
		// Explicitly cast the int literal to a byte
		byte as = (byte) 27; 
		
		byte a = 3; // No problem, 3 fits in a byte
		byte d = 8; // No problem, 8 fits in a byte
		//byte c = a + d; // Should be no problem, sum of the two bytes
		// fits in a byte
		
		byte c = (byte) (a + d);
		
		
		int t = 100;
		long l = t; // Implicit cast, an int value always fits in a long
		
		
		float w = 100.001f;
		int r = (int)w; // Explicit cast, the float could lose info
		
		
		double e = 100L; // Implicit cast
	}

}

class Casting {
	public static void main(String [] args) {
		//int x = 3957.229; // illegal
		int x = (int)3957.229; // legal cast
		System.out.println("int x = " + x);
		
		long l = 130L;
		byte b = (byte)l;
		System.out.println("The byte is " + b);
		
		float r = 23434.324f;
		short s = (short)r;
		System.out.println("la s:"+s);
		
		//float f = 32.3; wont' compile
		float f = (float) 32.3;
		float g = 32.3f;
		float h = 32.3F;
		
		//byte m = 128; // byte can only hold up to 127
	}
}


class ValueTest {
	public static void main (String [] args) {
		int a = 10; // Assign a value to a
		System.out.println("a = " + a);
		int b = a;
		b = 30;
		System.out.println("a = " + a + " after change to b");
	}
}


class Probando{
	public static void main(String argv[]){
		int j;
		//System.out.println("La jota:"+j);All the local varibales should be inictializad

	}
}